from pyspark import SparkConf, SparkContext

conf = SparkConf().setMaster("local[*]").setAppName("test_spark")
sc = SparkContext(conf=conf)

list_rdd = sc.parallelize([1, 2, 3, 4, 5])
tuple_rdd = sc.parallelize((1, 2, 3, 4, 5))
str_rdd = sc.parallelize("abcdefg")
set_rdd = sc.parallelize({1, 2, 3, 4, 5})
dict_rdd = sc.parallelize({"key1": "value1", "key2": "value2"})

print("list_rdd", list_rdd.collect())
print("tuple_rdd", tuple_rdd.collect())
print("str_rdd", str_rdd.collect())
print("set_rdd", set_rdd.collect())
print("dict_rdd", dict_rdd.collect())

print("直接打印list_rdd会怎样：")
print(list_rdd)

sc.stop()
